package cos.android.sprites;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;

public abstract class Element {

	private Bitmap sprite;

	private float xPos;
	private float yPos;

	private int height;
	private int width;

	private Rect rect;

	public Element(Bitmap sprite, int xPos, int yPos, int height, int width) {
		super();
		this.sprite = sprite;
		this.xPos = xPos;
		this.yPos = yPos;
		this.height = height;
		this.width = width;
		this.rect = new Rect(0,0,0,0);
	}

	public float getxPos() {
		return xPos;
	}

	public void setxPos(float xPos) {
		this.xPos = xPos;
	}

	public float getyPos() {
		return yPos;
	}

	public void setyPos(float yPos) {
		this.yPos = yPos;
	}

	public Bitmap getSprite() {
		return sprite;
	}

	public void setSprite(Bitmap sprite) {
		this.sprite = sprite;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public Rect getRect() {
		
		return rect;
	}

	public void setRect(Rect rect) {
		this.rect = rect;
	}
	
	public boolean checkCollision (Element element){
		
		return (rect.intersect(element.getRect()));
		
	}
	
	public abstract void draw(Canvas canvas);

}
